package com.tinyseed.emcp.api.exception.bean;

import com.tinyseed.emcp.api.basicdata.domain.convert.DTOConvert;
import com.tinyseed.emcp.api.exception.entity.ExceptionStatistics;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @ClassName ExceptionStatisticsOutputDTO
 * @Deacription 异常统计信息
 * @Author Clare.Zhuang
 * @Date 2020/5/1 23:21
 * @Version 1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExceptionStatisticsOutputDTO implements Serializable {
    /**
     * 唯一主键
     */
    private Long id;

    /**
     * 异常描述
     */
    private String description;

    /**
     * 异常类型
     */
    private String eventType;

    /**
     * 企业名称
     */
    private String enterpriseName;

    /**
     * 企业id
     */
    private Long enterpriseId;

    /**
     * 组织名称
     */
    private String organizeName;

    /**
     * 组织机构id
     */
    private Long organizeId;

    /**
     * 监测点名称
     */
    private String monitorName;

    /**
     * 监测点id
     */
    private String monitorId;

    /**
     * 监测点类型
     */
    private String equipmentType;

    /**
     * sms下发状态(Y：已下发 N：未下发)
     */
    private String smsIssuedStatus;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    private Timestamp createTime;

    /**
     * 最后修改时间
     */
    private Timestamp modifyTime;

    /**
     * 创建人
     */
    private String creator;

    /**
     * 最后操作人
     */
    private String modifier;

    /**
     * 计数
     */
    private Long count;

    /**
     * 产污监测点名称
     */
    private String produceName;

    /**
     * 产污监测点id
     */
    private String produceId;

    /**
     * 用备关系
     */
    private String relation;

    public ExceptionStatistics convertToExceptionStatistics() {
        ExceptionStatisticsOutputDTOConvert convert = new ExceptionStatisticsOutputDTOConvert();
        ExceptionStatistics result = convert.convert(this);
        return result;
    }

    private static class ExceptionStatisticsOutputDTOConvert implements DTOConvert<ExceptionStatisticsOutputDTO, ExceptionStatistics> {

        @Override
        public ExceptionStatistics convert(ExceptionStatisticsOutputDTO exceptionStatisticsOutputDTO) {
            ExceptionStatistics exceptionStatistics = new ExceptionStatistics();
            BeanUtils.copyProperties(exceptionStatisticsOutputDTO, exceptionStatistics);
            return exceptionStatistics;
        }
    }


}
